import 'package:cook_dinner/config/include.dart';
import 'package:cook_dinner/pages/search/search_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class HomeBanner extends StatelessWidget {
  const HomeBanner({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: HYSizeFit.screenWidth,
      height: 335.rpx,
      padding: EdgeInsets.only(top: 49.rpx, left: 22.rpx),
      decoration: const BoxDecoration(
        gradient: LinearGradient(
          begin: Alignment.topCenter,
          end: Alignment.bottomCenter,
          colors: [Color(0xffFBC302), Color(0xffFCD576)],
        ),
      ),
      child: Column(
        children: [
          SizedBox(
            width: double.infinity,
            height: 44.rpx,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text('COOK  TOGETHER',
                    style: TextStyle(
                        fontSize: 20.rpx,
                        color: Colors.white,
                        fontWeight: FontWeight.w600)),
                InkWell(
                  onTap: () => AppTo.goto(context, const SearchPage()),
                  child: Padding(
                    padding: EdgeInsets.only(right: 22.rpx),
                    child: Image.asset(
                      'assets/images/saerch.png',
                      width: 24.rpx,
                      height: 24.rpx,
                    ),
                  ),
                ),
              ],
            ),
          ),
          Image.asset(
            'assets/images/baner.png',
            width: double.infinity,
          ),
        ],
      ),
    );
  }
}

class HomeTitle extends StatelessWidget {
  const HomeTitle({Key? key, this.buns = true, this.title = '关注'})
      : super(key: key);
  final String title;
  final bool buns;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.only(
          left: 22.rpx, right: 22.rpx, top: 12.rpx, bottom: 18.rpx),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Text(
            title,
            style: TextStyle(color: Colors.black, fontSize: 16.rpx),
          ),
          buns
              ? InkWell(
                  child: Text(
                    '查看更多',
                    style: TextStyle(
                        color: const Color(0xffA6A6A6), fontSize: 14.rpx),
                  ),
                )
              : const SizedBox.shrink(),
        ],
      ),
    );
  }
}

class Recommended extends StatelessWidget {
  const Recommended({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.only(left: 22.rpx, right: 22.rpx),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Column(
            children: [
              SizedBox(
                width: 198.rpx,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    ClipRRect(
                      borderRadius: BorderRadius.circular(6.rpx),
                      child: Image.asset(
                        'assets/images/fish04.png',
                        width: 198.rpx,
                        height: 117.rpx,
                        fit: BoxFit.cover,
                      ),
                    ),
                    SizedBox(height: 14.rpx),
                    Text(
                      '零失败经典意式美味：自制意大利千层面',
                      style: TextStyle(
                        fontSize: 14.rpx,
                        color: const Color(0xff4d4d4d),
                        height: 1.3,
                      ),
                    ),
                    SizedBox(height: 4.rpx),
                    Text(
                      '实用贴士+地道食谱+素食变奏',
                      style: TextStyle(
                        fontSize: 12.rpx,
                        color: const Color(0xff999999),
                      ),
                    ),
                    SizedBox(height: 6.rpx),
                    Text(
                      '15 min',
                      style: TextStyle(
                        fontSize: 12.rpx,
                        color: const Color(0xffF35410),
                      ),
                    ),
                  ],
                ),
              ),
              SizedBox(height: 14.rpx),
              SizedBox(
                width: 198.rpx,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    ClipRRect(
                      borderRadius: BorderRadius.circular(6.rpx),
                      child: Image.asset(
                        'assets/images/fish06.png',
                        width: 198.rpx,
                        height: 117.rpx,
                        fit: BoxFit.cover,
                      ),
                    ),
                    SizedBox(height: 14.rpx),
                    Text(
                      '零失败经典意式美味：自制意大利千层面',
                      style: TextStyle(
                        fontSize: 14.rpx,
                        color: const Color(0xff4d4d4d),
                        height: 1.3,
                      ),
                    ),
                    SizedBox(height: 4.rpx),
                    Text(
                      '实用贴士+地道食谱+素食变奏',
                      style: TextStyle(
                        fontSize: 12.rpx,
                        color: const Color(0xff999999),
                      ),
                    ),
                    SizedBox(height: 6.rpx),
                    Text(
                      '15 min',
                      style: TextStyle(
                        fontSize: 12.rpx,
                        color: const Color(0xffF35410),
                      ),
                    ),
                  ],
                ),
              ),
              SizedBox(height: 14.rpx),
              SizedBox(
                width: 198.rpx,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    ClipRRect(
                      borderRadius: BorderRadius.circular(6.rpx),
                      child: Image.asset(
                        'assets/images/fish06.png',
                        width: 198.rpx,
                        height: 117.rpx,
                        fit: BoxFit.cover,
                      ),
                    ),
                    SizedBox(height: 14.rpx),
                    Text(
                      '零失败经典意式美味：自制意大利千层面',
                      style: TextStyle(
                        fontSize: 14.rpx,
                        color: const Color(0xff4d4d4d),
                        height: 1.3,
                      ),
                    ),
                    SizedBox(height: 4.rpx),
                    Text(
                      '实用贴士+地道食谱+素食变奏',
                      style: TextStyle(
                        fontSize: 12.rpx,
                        color: const Color(0xff999999),
                      ),
                    ),
                    SizedBox(height: 6.rpx),
                    Text(
                      '15 min',
                      style: TextStyle(
                        fontSize: 12.rpx,
                        color: const Color(0xffF35410),
                      ),
                    ),
                  ],
                ),
              ),
              SizedBox(height: 14.rpx),
            ],
          ),
          Column(
            children: [
              SizedBox(
                width: 171.rpx,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    ClipRRect(
                      borderRadius: BorderRadius.circular(6.rpx),
                      child: Image.asset(
                        'assets/images/fish05.png',
                        width: 171.rpx,
                        height: 221.rpx,
                        fit: BoxFit.cover,
                      ),
                    ),
                    SizedBox(height: 14.rpx),
                    Text(
                      '经典红烧肉：教你如何把红烧肉做的好看又美味',
                      style: TextStyle(
                        fontSize: 14.rpx,
                        color: const Color(0xff4d4d4d),
                        height: 1.3,
                      ),
                    ),
                    SizedBox(height: 4.rpx),
                    Text(
                      '实用贴士+地道食谱+素食变奏',
                      style: TextStyle(
                        fontSize: 12.rpx,
                        color: const Color(0xff999999),
                      ),
                    ),
                    SizedBox(height: 6.rpx),
                    Text(
                      '15 min',
                      style: TextStyle(
                        fontSize: 12.rpx,
                        color: const Color(0xffF35410),
                      ),
                    ),
                  ],
                ),
              ),
              SizedBox(height: 14.rpx),
              SizedBox(
                width: 171.rpx,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    ClipRRect(
                      borderRadius: BorderRadius.circular(6.rpx),
                      child: Image.asset(
                        'assets/images/fish05.png',
                        width: 171.rpx,
                        height: 221.rpx,
                        fit: BoxFit.cover,
                      ),
                    ),
                    SizedBox(height: 14.rpx),
                    Text(
                      '经典红烧肉：教你如何把红烧肉做的好看又美味',
                      style: TextStyle(
                        fontSize: 14.rpx,
                        color: const Color(0xff4d4d4d),
                        height: 1.3,
                      ),
                    ),
                    SizedBox(height: 4.rpx),
                    Text(
                      '实用贴士+地道食谱+素食变奏',
                      style: TextStyle(
                        fontSize: 12.rpx,
                        color: const Color(0xff999999),
                      ),
                    ),
                    SizedBox(height: 6.rpx),
                    Text(
                      '15 min',
                      style: TextStyle(
                        fontSize: 12.rpx,
                        color: const Color(0xffF35410),
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
